package com.system.controller;

import com.order.hit.crossover.platform.common.utils.PFResponse;
import com.order.hit.crossover.platform.common.bean.Store;
import com.system.mapper.StoreMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Lei
 * @version 0.1
 * @date 2020/9/13
 */
@RestController
@RequestMapping("/store")
public class StoreLogin {

    @Autowired
    private StoreMapper storeMapper;

    @PostMapping("/login")
    public PFResponse login(@RequestBody Store store){
        Store store1 = this.storeMapper.login(store.getStoreName(), store.getPassword());
        if (store1 == null){
            return new PFResponse().code(500).message("登陆失败").put("login", false);
        }
        return new PFResponse().code(200).message("登陆成功").put("login", true).data(store1);
    }
}
